from threading import Thread, Timer
from winsound import Beep
from time import sleep
from kthread import KThread

class FinalCountDown(KThread):
    def __init__(self):
        KThread.__init__(self)
        
    def play(self):
        self.start()
        
    def stop(self):
        self.terminate()
        
    def run(self):
        #while True:
        #    self.musikinha()
        self.musikinha()
    
    def musikinha(self):
        Beep(1708, 150)
        Beep(1536, 150)
        Beep(1708, 600)
        Beep(1152, 600)
        # sleep(0.9)
        # Beep(1761, 150)
        # Beep(1708, 150)
        # Beep(1761, 300)
        # Beep(1708, 300)
        # Beep(1536, 600)
        # sleep(0.9)
        # Beep(1761, 150)
        # Beep(1708, 150)
        # Beep(1761, 600)
        # Beep(1152, 600)
        # sleep(0.9)
        # Beep(1536, 150)
        # Beep(1364, 150)
        # Beep(1536, 300)
        # Beep(1364, 300)
        # Beep(1280, 300)
        # Beep(1536, 300)
        # Beep(1364, 450)
        # Beep(1280, 150)
        # Beep(1152, 300)
        # Beep(1708, 150)
        # Beep(1536, 150)
        # Beep(1708, 600)
        # Beep(1152, 600)
        # sleep(0.9)
        # Beep(1761, 150)
        # Beep(1708, 150)
        # Beep(1761, 300)
        # Beep(1708, 300)
        # Beep(1536, 600)
        # sleep(0.9)
        # Beep(1761, 150)
        # Beep(1708, 150)
        # Beep(1761, 600)
        # Beep(1152, 600)
        # sleep(0.9)
        # Beep(1536, 150)
        # Beep(1364, 150)
        # Beep(1536, 300)
        # Beep(1364, 300)
        # Beep(1280, 300)
        # Beep(1536, 300)
        # Beep(1364, 600)
        # Beep(1280, 150)
        # Beep(1364, 150)
        # Beep(1536, 600)
        # Beep(1364, 150)
        # Beep(1536, 150)
        # Beep(1708, 300)
        # Beep(1536, 300)
        # Beep(1364, 300)
        # Beep(1280, 300)
        # Beep(1152, 600)
        # Beep(1761, 600)
        # Beep(1708, 1200)
        
if __name__ == "__main__":
    a = FinalCountDown()
    a.play()
    print 'Digite \'stop\' para parar a musica'
    while True:
        c = raw_input()
        if c == 'stop':
            a.stop()
            break
    print 'saindo do programa..'

    

